<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/fn.tld" prefix="fn" %>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/core.tld" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBliC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>申请行程单</title>
<base href="<%=basePath %>" />
<link href="orderManager/member/css/login.css" rel="stylesheet" type="text/css" />
<LINK href="orderManager/member/css/header-min.css" rel=stylesheet>
<script type="text/javascript" src="orderManager/css/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/script/My97DatePicker/WdatePicker.js" defer="defer"></script>
</head>

<body>


<jsp:include page="/pub_head.jsp"></jsp:include>
	<!-- 中间 -->
	<div id="page-container">
<form action="/flight/order.do?op=notApply" method="post">
	  <div id="content" style="border: solid 1px #0183BD;"><div class="p16"><DIV class="tb-1">
  <table width="760" height="37">
	<tr>
		<td width="248" height="31" class="tdl">
		  <label>订单开始时间：</label>
		  <input id="startDate" size="15" name="startDate" class="Wdate" onfocus="WdatePicker({isShowWeek:true,maxDate:'%y-%M-%d'})" value="${order.startDate }" readonly="readonly" />		</td>
		<td width="246" class="tdl"><label>订单结束时间：</label>
		  <input id="endDate" size="15" name="endDate" class="Wdate" onfocus="WdatePicker({isShowWeek:true,maxDate:'%y-%M-%d',minDate:'#F{$dp.$D(\'startDate\')}'})" value="${order.endDate }" readonly="readonly"/></td>
	    <td width="63" class="tdl"><button class="button2" id="J_SearchOrders" type="submit">
		搜索</button></td>
	</tr>
	<!-- add -->
</table>
      </DIV></div>
	  <div id="listbb">
	  <div align="center">
        <table class="tablet" cellspacing="1" cellpadding="3" border="0">
          <tr>
            <td class="tdt" height="128">
            <table cellpadding="0" cellspacing="0" width="740">
                <tr>
                  <th width="60" align="left">&nbsp;<c:if test="${orders!=null&&fn:length(orders)>0}"><input type="checkbox" name="ckAll" id="ckAll" value="1"/>全选</c:if>&nbsp;</span></th>
              	  <th width="70" height="58"><span class="black-text">乘客姓名</span></th>
                  <th class="tdi" width="88">航程信息</th>
                  <th class="tdl" width="103">出发时间</th>
                  <th class="tdi" width="79">机票号码</th>
                  <th class="tdi" width="79">PNR</th>
                  <th class="tdi" width="94">行程单状态</th>
                  <th class="tdi" width="72">订单状态</th>
                </tr>
            </table>
              </td>
          </tr>
          <c:if test="${orders!=null&&fn:length(orders)>0}">
          <logic:iterate id="order" name="orders" indexId="index">
          	<tr>
            <td width="731" height="66">
			<table cellpadding="0" cellspacing="0" width="740">
                <tr>
                  <td width="50"><input type="checkbox" id="ck_${index}" name="ck" value="${order.id}" /></td>
                  <td width="70" height="58"><span class="black-text">${order.passenger}</span></td>
                  <td class="tdi" width="88">${order.voyage}</td>
                  <td class="tdl" width="103"><bean:write name="order" property="flightDate" format="yyyy-MM-dd HH:ss"/></td>
                  <td class="tdi" width="100">${order.ticketNo }</td>
                  <td class="tdi" width="79">${order.pnrNo}</td>
                  <td class="tdi" width="94"><span style="color: red">未申请</span></td>
                  <td class="tdi" width="72"><span class="jg"><span class="tkcg">出票完成</span></span></td>
                </tr>
            </table></td>
          </tr>
          </logic:iterate>
          </c:if>
          <c:if test="${orders!=null&&fn:length(orders)==0}">
          <tr>
          	<td colspan="9"  height="58"><h4>为搜索到相关信息</h4></td>
          </tr>
          </c:if>
	    </table>
      </div>
	</div>
	  <div id="xm">
	  <div id="hbfk"></div>
	   <div class="sabrosus">
  	    	<select name="page" onchange="javascript:document.forms[0].submit();">
  	    	<c:forEach var="t" begin="1" end="${page.totalPage}">
  	    	<option value="${t}" 
  	    	<c:if test="${page.pageIndex==t}">
  	    		selected="selected"
  	    	</c:if>
  	    	> 第${t}页</option>
			</c:forEach>
  	    	</select>
  	    </div>
  	    <div id="hbfk"></div>
  	  <div class="sabrosus" style="display: none"><span class="disabled">首页</span><span class="current">1</span><a href="#?page=2">2</a><a href="#?page=3">3</a>...<a href="#?page=199">下一页</a><a href="#?page=2">尾页</a><span class="abc">到第
  	    <input id="J_PageNum"  class="xminput" name="pageNum" />
  	    页
  	    <input name="Submit23" type="submit" class="buttonss" value="确定" />
  	    </span></div>
	  </div>
	  </form>
	  <div id="listbb">
	  <div align="center">
	  <form action="/flight/itinApply.do?op=apply" name="itform" style="border: 0;" method="post">
        <table class="tablet" style="width: 500px" cellspacing="1" cellpadding="3" border="0">
         <tr>
          <td colspan="2">邮寄费：<font color="red">10</font> 元；每张行程单收取 <font color="red">1</font> 元手续费<label></label> </td>
          </tr>
          <tr>
           <td width="20%" style="text-align: right;">收件人&nbsp;&nbsp;</td>
           <td style="text-align: left;">&nbsp;&nbsp;<input name="item.name" id="name" value="" /></td>
          </tr>
          <tr>
           <td style="text-align: right;">联系电话&nbsp;&nbsp;</td>
           <td style="text-align: left;">&nbsp;&nbsp;<input name="item.phone" id="phone" maxlength="11" value="" /></td>
          </tr>
           <tr>
           <td style="text-align: right;">邮政编码&nbsp;&nbsp;</td>
           <td style="text-align: left;">&nbsp;&nbsp;<input maxlength="6" name="item.zip" id="zip" value="" /></td>
          </tr>
          <tr>
           <td style="text-align: right;">详细地址&nbsp;&nbsp;</td>
           <td style="text-align: left;">&nbsp;&nbsp;<input name="item.address" style="width: 90%" id="address" value="" /></td>
          </tr>
          <tr>
           <td style="text-align: right;">总金额&nbsp;&nbsp;</td>
           <td style="text-align: left;">&nbsp;&nbsp;共计 <label id="lab" style="font-weight: bolder; color: red; font-size: 18px">0</label> 元
           <input name="item.payTotal" id="payTotal" type="hidden" value="" /></td>
          </tr>          
          <tr>
           <td align="center" colspan="2"><input type="button" onclick="valForm()" value="提交" /></td>
           <input type="text" name="item.orderNo" id="orders" readonly="readonly" style="width: 100%" />
          </tr>
	    </table></form>
	    <br/>
      </div>
	</div>
	<script type="text/javascript">
<!--
var ck_state,orders='',count=0;
	$('input[name="ckAll"]').click(function(){
	orders='';
	count=0;
	var ck_state = $(this).attr('checked');
		$('input[name="ck"]').each(function(i){
			$(this).attr('checked',ck_state);
			if(ck_state==true){
			var ck_id=$(this).attr('id');
			count+=1;
			orders+=$(this).val()+',';
			}
		});
	orders=orders.substring(0,orders.lastIndexOf(','));
	if(count>0){count=count+10;}
	$('#lab').text(count);
	$('#payTotal').val(count);
	$('#orders').val(orders);
	});
	$('input[name="ck"]').click(function(i){
		orders='';
		count=0;
		$('input[name="ckAll"]').attr('checked',false);
		$('input[name="ck"]').each(function(i){
			$(this).attr('checked',ck_state);
			if($(this).attr('checked')==true){
			count= count + 1;
			orders+=$(this).val()+','
			}
		});
		orders=orders.substring(0,orders.lastIndexOf(','));
		if(count>0){count=count+10;}
		$('#lab').text(count);
		$('#payTotal').val(count);
		$('#orders').val(orders);
	});
	function valForm(){
		if($.trim($('#orders').val())==''){
			alert('请选择需要申请行程单的订单');
			return;
		}
		if($.trim($('#name').val())==''){alert('收件人不能为空');$('#name').focus();return;}
		if($.trim($('#phone').val())==''){alert('联系电话不能为空');$('#phone').focus();return;}
		if($.trim($('#zip').val())==''){alert('邮政编码不能为空');$('#zip').focus();return;}
		if($.trim($('#address').val())==''){alert('详细地址不能为空');$('#address').focus();return;}
		document.forms['itform'].submit();
	}
//-->
</script>
	</div>
	
<iframe id="frmLeft" name="frmLeft" src="/orderManager/left_buy.jsp" width="154" height="650" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>
	
</div>

<div id="page-container">
<%@include file="/footer.jsp" %>
</div>

	</body>
</html>

